﻿

namespace Mulala.Cavan.Domain.MainBoundedContext.MulalaModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Mulala.Cavan.Core.Persistent;
    using Mulala.Cavan.Domain.MainBoundedContext.NannyModule;
    using Mulala.Cavan.Domain.MainBoundedContext.SearchModule;
    using Mulala.Cavan.Core.MyLinq;

    public class NannyCommentSpecification : ISpecification<NannyComment, NannyCommentSearch>
    {
        public NannyCommentSearch SearchParams
        {
            get;
            set;
        }

        public System.Linq.Expressions.Expression<Func<NannyComment, bool>> Expression
        {
            get 
            {
                IQueryBuilder<NannyComment> queryBuilder = QueryBuilder.Create<NannyComment>();

                if (null != SearchParams)
                {
                    if (SearchParams.NannyID > 0)
                    {
                        queryBuilder = queryBuilder.Equals(nc => nc.Nanny.ID, SearchParams.NannyID);
                    }
                }

                return queryBuilder.Expression.Expand();
            }
        }
    }
}
